/*
 * @Author: 谢子健 1075010289@qq.com
 * @Date: 2024-09-21 22:08:46
 * @LastEditors: 谢子健 1075010289@qq.com
 * @LastEditTime: 2024-09-21 22:10:57
 * @FilePath: \ilink-vue-frontend\src\api\data\datasetActions.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// src/api/data/datasetActions.ts
import { api } from '../api';

/**
 * 下载数据集 (Download Dataset)
 * @param targetId 数据集 ID
 * @returns API 响应数据
 */
export const downloadDataset = async (targetId: string) => {
  try {
    const response = await api.post('/java/ground/dataset/download_dataset', { targetId });
    return response.data;
  }
  catch (error) {
    console.error('Error downloading dataset:', error);
    throw error;
  }
};

/**
 * 分享数据集 (Share Dataset)
 * @param targetId 数据集 ID
 * @returns API 响应数据
 */
export const shareDataset = async (targetId: string) => {
  try {
    const response = await api.post('/java/ground/dataset/share_dataset', { targetId });
    return response.data;
  }
  catch (error) {
    console.error('Error sharing dataset:', error);
    throw error;
  }
};
